package com.example.common.context;

public class UserContext {
    // ThreadLocal 线程本地变量
    private static final ThreadLocal<Long> THREAD_LOCAL_USER = new ThreadLocal<>();

    public static void setUserId(Long userId) {
        THREAD_LOCAL_USER.set(userId);
    }

    public static Long getUserId() {
        return THREAD_LOCAL_USER.get();
    }
}
